<?php
/**
 * Created by PhpStorm.
 * User: Dominik
 * Date: 4/7/14
 * Time: 9:51 PM
 * NUMBER THINGS
 */
include("validator.php");
$validator = new Validator();
session_start();

foreach($_SESSION as $key => $value){
    echo "<br/>" . $key . " => " . $value;
}

if(isset($_POST[next])){

    if(!is_numeric($_POST[weight])){
        $report[height] = "Jmeno muze obsahovat pouze znaky a mezery.";
    }
    if(!is_numeric($_POST[height])){
        $report[height] = "Prijmeni muze obsahovat pouze znaky a mezery.";
    }
    if(!is_numeric($_POST[beer])){
        $report[beer] = "Prijmeni muze obsahovat pouze znaky a mezery.";
    }

    if(empty($report)){
        $_SESSION['weight'] = $_POST[weight];
        $_SESSION['height'] = $_POST[height];
        $_SESSION['beer'] = $_POST[beer];
        ?>
        <meta http-equiv="refresh" content="0;url=http://databaze.fbmi.cvut.cz/fialadom/BITWA/CV7/wizzard3.php">
        <?
    }
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="zajimaveeeeeee" content="PhpStorm 7.0">
    <link rel="stylesheet" type="text/css" href="style.css">
    <title>BITWA - Fiala Dominik</title>

</head>
<body>
<div id="hlavicka">
    <h1 align="center">BITWA</h1><br>
</div>
<div id="menu">
    <? include "menu.php" ?>
</div>
<div id="obsah">
    <form method="POST" action="" >

        <label for="weight"> Vaha (kg)</label>
        <input type="text" id="weight" name="weight" placeholder="weight" value="<?php echo $_POST['weight'];?>">

        <br/>
        <label for="height"> Vyska (cm)</label>
        <input type="text" id="height" name="height" placeholder="height" value="<?php echo $_POST['height'];?>">

        <br/>
        <label for="beer"> Pocet piv </label>
        <input type="text" id="beer" name="beer" placeholder="beer" value="<?php echo $_POST['beer'];?>">

        <br/>
        <input type="submit" name="next" value="Dalsi">

    </form>
    <?
        foreach($report as $chyba){
            echo "<br/>".$chyba;
        }
    ?>
</div>
<div id="copyright">
    &copy fialadom
</div>
</body>
</html>